package cn.lookup;

import cn.lookup.dao.AccountDao3;
import cn.lookup.dao.AccountOrderDao;
import cn.lookup.domain.Account;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class AccountOrder {
    @Test
    public void findAccountOrder() throws IOException {
        InputStream resourceAsStream = Resources.getResourceAsStream("SqlMapperConfig.xml");
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(resourceAsStream);
        SqlSession sqlSession = build.openSession();
        AccountOrderDao mapper = sqlSession.getMapper(AccountOrderDao.class);
        Account accountOrder = mapper.findAccountOrder(1);
        System.out.println(accountOrder);
        sqlSession.close();
    }
    @Test
    public void findAccountOrder2() throws IOException {
        InputStream resourceAsStream = Resources.getResourceAsStream("SqlMapperConfig.xml");
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(resourceAsStream);
        SqlSession sqlSession = build.openSession();
        AccountOrderDao mapper = sqlSession.getMapper(AccountOrderDao.class);
        Account accountOrder = mapper.findAccountOrder2(1);
        System.out.println(accountOrder);
        sqlSession.close();
    }
}
